package com.register;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import com.jdbcUtil.JDBCUtil;
import com.login.UserInfo;

public class RegisterImpl {
	public boolean register(UserInfo user){
		Connection conn=null;
		PreparedStatement ps=null;
		ResultSet rs=null;
		int i=-1;
		try{
			conn=JDBCUtil.getConnection();
			String sql="insert into user (upassword, uname, uemail) values (?, ?, ?)";
			ps=conn.prepareStatement(sql);
			ps.setString(1, user.getPassword());
			ps.setString(2, user.getName());
			ps.setString(3, user.getEmail());
			i=ps.executeUpdate();
			if(i>0){
				return true;
			}
		}catch(Exception e){
			System.out.println(e);
		}finally{
			JDBCUtil.free(conn, ps, rs);
		}
		return false;
	}
}
